package com.stylefeng.guns.modular.vpn.utils;

import com.stylefeng.guns.core.log.LogManager;
import com.stylefeng.guns.core.shiro.ShiroKit;
import com.stylefeng.guns.core.shiro.ShiroUser;
import com.stylefeng.guns.modular.vpn.core.log.VpnLogTaskFactory;

/**
 * @Description TODO
 * @Author Mr.GodRui
 * @Date 2020-04-20 17:44
 **/
public class LogUtil {
    /**
     * 保存操作日志
     * @param itemName
     * @param content
     */
    public static void saveOperationLog(String itemName,String content){
        try {
            ShiroUser user = ShiroKit.getUser();
            if (null != user) {
                LogManager.me().executeLog(VpnLogTaskFactory.operationLog(user.getId(),
                        user.getName(), itemName, content));
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
